import { Opt } from '__com/Opt.js'
import ruleOpt from '@/option/rule.js'
import cityOpt from '@/option/city.js'
export class editOpt extends Opt {
  constructor(fun) {
    super(fun)
  }

  create() {
    return [
      {
        placeholder: '变更前账号数',
        text: {
          className: 'info-label-title'
        }
      },
      {
        title: '项目账号数',
        key: 'accountNumberLast',
        group: [
          {
            key: 'accountNumberLast',
            col: 4,
            text: {}
            // data: {
            //   from: (info) => {
            //     return info.accountNumberLast === 0 ? 0 : '-'
            //   }
            // }
          },
          {
            placeholder: '个',
            col: 2,
            text: {}
          }
        ]
      },
      {
        title: '已使用账号数',
        key: 'sueAccount',
        group: [
          {
            key: 'sueAccount',
            col: 4,
            text: {}
            // data: {
            //   from: (info) => {
            //     return info.accountNumber - info.accountSurplusNumber
            //   }
            // }
          },
          {
            placeholder: '个',
            col: 2,
            text: {}
          }
        ]
      },
      {
        title: '剩余账号数',
        key: 'accountSurplusNumber',
        group: [
          {
            key: 'accountSurplusNumber',
            col: 4,
            text: {}
          },
          {
            placeholder: '个',
            col: 2,
            text: {}
          }
        ]
      },
      {
        placeholder: '变更后账号数',
        text: {
          className: 'info-label-title'
        }
      },
      {
        title: '项目账号数',
        key: 'accountNumber',
        placeholder: '请输入变更后的“项目账号数”的总数',
        group: [
          {
            key: 'accountNumber',
            col: 14,
            input: {
              maxlength: 5,
              change: (val) => {
                this.accChange()
              }
            }
          },
          {
            placeholder: '个',
            col: 4,
            text: {}
          }
        ],

        rules: [ruleOpt.required('请填写项目账号数'), ruleOpt.positiveInteger()]
      }
      // {
      //   title: '剩余账号数',
      //   key: 'remaining',
      //   group: [
      //     {
      //       key: 'remaining',
      //       col: 4,
      //       text: {
      //         color: this.accData.remaining < 0 ? 'red' : ''
      //       }
      //     },
      //     {
      //       placeholder: '个',
      //       col: 2,
      //       text: {}
      //     }
      //   ]
      // }
    ]
  }
}
